<?php $this->_extends('_layouts/default_layout'); ?>
 
<?php $this->_block('contents'); ?>

<h3>部门编辑</h3>
<form id="form_usersetting" name="form_usersetting" action="<?php echo url('departments/edit'); ?>" method="post" enctype="application/x-www-form-urlencoded" qform_group_id="" 
        onsubmit="
		if (this.column_title.value == '') { 
		alert('请输入部门名称'); 
		return false; }
		else { 
			if (this.column_desc.value == '') 
			{ 
				alert('请输入部门描述'); 
				return false; 
			}
			return true; 
		}"
>

  <fieldset>
    

  <p id="column_name" >
    <label for="department_title">部门名称&nbsp;</label>
     <label><span class="error" name="warn_name" style="display:none" id="10014">请输入部门名称</span></label>
    <input type="text"  id="10013" name="department_title" onBlur="CheckIsNull(10013, 10014)" value="<?php echo $dep->department_name ?>" class="textbox_short" />
  </p>


  <p id="column_desc" >
    <label for="column_desc">部门描述&nbsp;</label>
    
    <label><span class="error" name="warn_phone" style="display:none" id="10016">请输入部门描述</span></label>
    
    <textarea type="num"  id="10015" name="department_desc"  value="" onBlur="CheckIsNull(10015, 10016)" class="textbox" rows="10"  ><?php echo $dep->department_desc ?></textarea>
  </p>
	  <input type="hidden" name="department_id" id="department_id" value="<?php echo $dep->department_id ?>" />
   <p>
   <input type="submit" name="btn_submit" value="发送" class="btn" />      
   </p>

  </fieldset>
<script>
	function   LTrim(str)           //   左空格 
	{   
			var   i=0;  
			for(i=0;i <str.length;i++)   
			{   
			if(str.charAt(i)!= "   "&&str.charAt(i)!= "   ")break;
			}   
			str=str.substring(i,str.length);   
			return   str;   
	}   
	function   Trim(str)     //   两边空格 
	{   
			return   LTrim(str);   
	}  

    function CheckIsNull(check_id, des_id)
	{
        var name = document.getElementById(check_id);
		if("" == name.value || Trim(name.value)== " ")
		{				
			var objSrc = document.getElementById(des_id);
			objSrc.style.display = "";
		} 
		else
		{
			var objSrc = document.getElementById(des_id);
			objSrc.style.display = "none";
		}
	}
</script>

</form><?php $this->_endblock(); ?>